package com.baidu.xiaosu.controller;

import com.baidu.xiaosu.bean.User;
import com.baidu.xiaosu.service.Demo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class DemoController {

    @Autowired
    private Demo demo;

    @RequestMapping("/getById/{id}")
    /*@HystrixCommand(fallbackMethod = "giao")*/
    public User getById(@PathVariable("id") String id){
        User user = demo.getById(id);
        return user;
    }
    public User giao(@PathVariable("id") String id){
        User user = new User();
        user.setName("错误");
        user.setPassword("错误");
        return user;
    }

}
